package com.wx.plugin.repository;


import com.yangzcp.userpojo.Members;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface MembersRepository extends JpaRepository<Members, Integer>{
    @Query("from Members where yaoqing_ma=?1")
    Members findByYaoqing_ma(String yaoqingma);
    @Query("from Members where weixin_openid=?1")
    Members findByWeixin_openid(String weixin_openid);
    @Query("select count(*) from Members where ref_member.id=?1")
    int countOneLevelMembers(Integer id);
    @Query("select count(*) from Members where sale_id=?1 and ref_member.id != ?1")
    int countTwoLevelMembers(Integer id);
    @Query("from Members where ref_member.id=?1 and recommend_id2=?2")
    List<Members> ownerMembers(Integer id, Integer recommenid);

    Members findByTel(String tel);
}
